package com.flyme.module.base.provider.service.impl;

import com.flyme.common.core.security.OpenHelper;
import com.flyme.common.core.security.OpenUserAuth;
import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.base.client.entity.SysOperationlog;
import com.flyme.module.base.provider.mapper.SysOperationlogMapper;
import com.flyme.module.base.provider.service.SysOperationlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * @author: zyf
 * @date: 2018/10/24 16:33
 * @description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysOperationlogServiceImpl extends BaseServiceImpl<SysOperationlogMapper, SysOperationlog> implements SysOperationlogService {

    @Autowired
    private SysOperationlogService sysOperationlogService;

    /**
     * 添加操作日志
     */
    public Boolean addOperation(String opremark){
        OpenUserAuth userAuth = OpenHelper.getUserAuth();
        SysOperationlog operationlog = new SysOperationlog();
        operationlog.setUserId(userAuth.getUserId());
        operationlog.setUserName(userAuth.getUsername());
        operationlog.setOpremark(opremark);
        return sysOperationlogService.saveOrUpdate(operationlog);
    }

}
